package com.gexiaobao.pigeon.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.model.bean.QueryBankListResponse
import com.gexiaobao.pigeon.app.util.Util

/**
 * @Author      : hxw
 * @Date        : 2023/4/20 18:26
 * @Describe    :
 */
class BankListAdapter(data: ArrayList<QueryBankListResponse.ListBean>) :
    BaseQuickAdapter<QueryBankListResponse.ListBean, BaseViewHolder>(R.layout.item_bank, data) {

    override fun convert(holder: BaseViewHolder, item: QueryBankListResponse.ListBean) {
        if (holder.layoutPosition % 2 == 1) {
            holder.setBackgroundResource(R.id.bank_card_item_cv, R.drawable.grant_bank_card_orange)
        } else {
            holder.setBackgroundResource(R.id.bank_card_item_cv, R.drawable.grant_bank_card_yellow)
        }
        holder.setText(R.id.tv_item_account_bank_card_name, item.bankName)
        holder.setText(
            R.id.tv_item_account_bank_card_type,
            if (item.cardType == 1) context.getString(R.string.bankcard1) else context.getString(R.string.bankcard2)
        )
        holder.setText(R.id.tv_item_account_bank_card_no, Util.checkCardNo(item.bankCardNo))
    }
}